package com.luo.chengrui.wordprint.example;

import com.luo.chengrui.wordprint.RenderDataFactory;
import com.luo.chengrui.wordprint.WordPrinter;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
 * word模板生成示例
 *
 * @author
 * @version 1.0.0
 * @description
 * @createTime 2023/12/08
 */

public class WordPrinterTest {

    public static void main(String[] args) throws IOException {
        UserArchivesDTO user = new UserArchivesDTO();
        user.setAge("18");
        user.setClazz("高三二班");
        user.setHeight("180");
        user.setSchool("成都七中");
        user.setUsername("张峰");
        user.setId(10234);
        user.setSex("男");
        List<UserArchivesDTO.Family> families = new ArrayList<>();
        user.setFamily(families);

        UserArchivesDTO.Family father = new UserArchivesDTO.Family();
        father.setFamilyAge("50");
        father.setFamilyCareer("工程师");
        father.setFamilyName("张三");
        father.setFamilyEducation("本科");
        father.setRelationship("父亲");
        father.setFamilyRemark("/");

        UserArchivesDTO.Family mather = new UserArchivesDTO.Family();
        mather.setFamilyAge("50");
        mather.setFamilyCareer("工程师");
        mather.setFamilyName("李四");
        mather.setFamilyEducation("本科");
        mather.setRelationship("母亲");
        mather.setFamilyRemark("/");

        families.add(father);
        families.add(mather);

        RenderDataFactory util = new RenderDataFactory().data(user).addImg("image", "D:\\TEST\\user-images.jpg", 40, 40);
        WordPrinter.generate("D:\\TEST\\学生档案.docx", "D:\\TEST\\" + user.getUsername() + ".docx", util.getData());

    }
}
